

package com.scs.application.modules.base.dto;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.handler.inter.IExcelDataModel;
import cn.afterturn.easypoi.handler.inter.IExcelModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.scs.application.core.model.DataEntity;
import com.scs.application.core.utils.excel.annotation.ExcelAutoColumnSize;
import com.scs.application.core.utils.excel.annotation.ExcelComment;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 商品实体对象
 */
@ExcelAutoColumnSize
@TableName("material")
@Data
@EqualsAndHashCode(callSuper = false)
@ToString(callSuper = true)
@Accessors(chain = true)
public class ExcelMaterialDTO extends DataEntity implements IExcelDataModel, IExcelModel, Serializable {

    private String materialId;

    private String supplierId;

    @ExcelComment(notNull = true, example = "供应商测试")
    @Excel(name = "供应商名称")
//    @NotNull(message = "供应商名称不能为空")
    private String supplierName;

    /**
     * 品类ID
     */
//    @NotNull(message = "品类ID不能为空")
    private String catalogId;

    @Excel(name = "品类代码")
    @ExcelComment(notNull = true, example = "cat001")
    private String catalogCode;

    @Excel(name = "品类名称", width = 25)
    // @NotNull(message = "品类名称不能为空")
    private String catalogName;

    /**
     * 生产厂商Id
     */
    private String manufacturerId;

    //    @Excel(name = "厂商代码")
//    @NotNull(message = "厂商代码不能为空")
    private String manufacturerCompanyCode;

    @ExcelComment(notNull = true, value = "如果厂商名称为空就填：默认厂商", example = "厂商测试")
    @Excel(name = "厂商名称", width = 29)
    @NotBlank(message = "厂商名称不能为空")
    private String manufacturerName;

    /**
     * 商品类型
     */
    @ExcelComment(notNull = true, dict = "base_material_type", example = "2")
    @Excel(name = "商品类型", dict = "base_material_type")
    @NotNull(message = "商品类型不能为空")
    private String materialTypeCode;

    /**
     * 品名
     */
    @ExcelComment(notNull = true, value = "院内耗材名称", example = "商品测试")
    @Excel(name = "品名", width = 25)
    @NotBlank(message = "品名不能为空")
    @Length(min = 1, max = 100, message = "品名长度必须介于 1 和 50 之间")
    private String materialName;

    /**
     * 商品名
     */
    @ExcelComment(value = "(学术名)选填；", example = "商品测试")
    @Excel(name = "商品名", width = 25)
//    @NotBlank(message = "商品名不能为空")
//    @Length(min = 1, max = 50, message = "商品名长度必须介于 1 和 50 之间")
    private String materialTradeName;

    /**
     * ERP代码
     */
    @ExcelComment(value = "选填", example = "erp001")
    @Excel(name = "ERP代码")
    @Length(max = 30, message = "ERP代码长度必须介于 0 和 30 之间")
    private String materialErpCode;

    /**
     * 助记码
     */
    //@ExcelComment(example = "ZZQ")
    //@Excel(name = "助记码")
    @Length(max = 10, message = "助记码长度必须介于 0 和 10 之间")
    private String pinyin;

    /**
     * 注册证号
     */
    @ExcelComment(value = "选填", example = "国械注进001")
    @Excel(name = "注册证号", width = 25)
    @Length(max = 50, message = "注册证号长度必须介于 0 和 50 之间")
    private String certificateNo;

    /**
     * 注册证效期
     */
    @ExcelComment(value = "日期格式：2010-01-01；选填；", example = "2050-01-01")
    @Excel(name = "注册证效期", databaseFormat = "yyyyMMddHHmmss", format = "yyyy-MM-dd")
    private java.util.Date certificateExpiredDate;

    /**
     * 批准文号
     */
    @ExcelComment(value = "选填；", example = "aaaa")
    @Excel(name = "批准文号")
    @Length(max = 50, message = "批准文号长度必须介于 0 和 50 之间")
    private String approvalNo;

    @ExcelComment(notNull = true, value = "如果规格为空就填：默认品规", example = "规格测试")
    @Excel(name = "规格", orderNum = "10", isImportField = "true")
    @NotBlank(message = "规格不能为空")
    @Length(min = 1, max = 100, message = "规格长度必须介于 1 和 100 之间")
    private String materialSpec;

    @ExcelComment(notNull = true, dict = "base_material_coding_type", example = "1")
    @Excel(name = "编码格式", orderNum = "20", dict = "base_material_coding_type")
    @NotNull(message = "编码格式不能为空")
    private String inputCodingType;


    @ExcelComment(value = "具体的国标码/GTIN码", example = "123123")
    @Excel(name = "输入编码", orderNum = "30")
    @Length(max = 30, message = "输入编码长度必须介于 0 和 30 之间")
    private String inputCode;


    //    @Excel(name = "剂型", orderNum = "40")
    @Length(max = 30, message = "剂型长度必须介于 0 和 30 之间")
    private String form;

    @ExcelComment(notNull = true, example = "盒")
    @Excel(name = "单位", orderNum = "50")
    private String unit;

    @ExcelComment(notNull = true, value = "如果价格为空就填0", example = "100.00")
    @Excel(name = "价格(元)", orderNum = "60")
    private Double price;

    @ExcelComment(notNull = true, dict = "common_yes_no", example = "1")
    @Excel(name = "寄售", orderNum = "70", dict = "common_yes_no")
    @NotNull(message = "寄售不能为空")
    private Integer isConsignment;


    @ExcelComment(notNull = true, dict = "common_yes_no", example = "0")
    @Excel(name = "一物一码", orderNum = "80", dict = "common_yes_no")
    @NotNull(message = "一物一码不能为空")
    private Integer isOneThingOneYard;

    private String id;

    private Integer rowNum;
    private String errorMsg;

    @Override
    public Integer getRowNum() {
        return rowNum;
    }

    @Override
    public void setRowNum(Integer rowNum) {
        this.rowNum = rowNum;
    }

    @Override
    public String getErrorMsg() {
        return errorMsg;
    }

    @Override
    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }
}
